package love.yuanmeng.guetcoalsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import love.yuanmeng.guetcoalsystem.pojo.Bond;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BondMapper extends BaseMapper<Bond> {

    @Select("SELECT * FROM bond where enterprise_id=${enterprise_id}")
    Bond selectbo(@Param("enterprise_id") String enterprise_id);


    @Update("update bond set account_balance=${account_balance},unfrozen_amount=${unfrozen_amount}where bond_id=${bond_id}")
    int updatebo(@Param("bond_id") String bond_id,@Param("account_balance") String account_balance,@Param("unfrozen_amount") String unfrozen_amount);

    @Update("update bond set unfrozen_amount=${unfrozen_amount},contract_frozen_amount=${contract_frozen_amount} where bond_id=${bond_id}")
    int updatebo2(@Param("bond_id") String bond_id,@Param("unfrozen_amount") String unfrozen_amount,@Param("contract_frozen_amount") String contract_frozen_amount);



    @Insert("INSERT into bond set enterprise_id=${enterprise_id},account_balance=${price},unfrozen_amount=${price},contract_frozen_amount=0.0")
    int addbo(@Param("enterprise_id") String enterprise_id,@Param("price") String price);

}

